package br.com.assessoriaesportiva.jpautil;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class EntityManagerFactoryProduce {

	@Produces
	@Local
	@ApplicationScoped
	public EntityManagerFactory create() {
		return Persistence.createEntityManagerFactory("assessoriadb"); // 3
	}

	public void destroy(@Disposes @Any EntityManagerFactory factory) { // 4
		factory.close(); // 5
	}

}
